package com.sbtr.business.project.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.project.entity.AlgoPredictRecord;
import com.sbtr.business.project.dto.AlgoPredictRecordDto;

import com.sbtr.business.project.service.AlgoPredictRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.project.mapper.AlgoPredictRecordMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 预测记录 Service接口实现类
 *
 * @author dgl
 * @since  2024-06-18
 */
@Transactional
@Service
public class AlgoPredictRecordServiceImpl extends ServiceImpl<AlgoPredictRecordMapper,AlgoPredictRecord> implements AlgoPredictRecordService {

    @Autowired
    AlgoPredictRecordMapper algoPredictRecordMapper;

    @Override
    public PageDto<AlgoPredictRecord> pageList(AlgoPredictRecordDto algoPredictRecordDto) {

        IPage<AlgoPredictRecord> page = new Page<>();
        page.setSize(algoPredictRecordDto.getPageSize());
        page.setCurrent(algoPredictRecordDto.getPage());
        page = algoPredictRecordMapper.selectPages(page, BeanUtil.beanToMap(algoPredictRecordDto));
        PageDto<AlgoPredictRecord> r = PageDtoUtils.getPageDtoByIPage(page, AlgoPredictRecord.class);

        return r;
    }
}

